/* 
 * File:   arraytest.cpp
 * Author: asicherer
 *
 * Created on May 26, 2008, 10:43 AM
 */

#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include "Array2D.h"
#include "Array1D.h"

template <class T>
void Print(const Array1D<T> &m)
{
    for (unsigned int i = 0; i < m.size(); ++i)
    {
        std::cout << m[i] << " ";
    }
    std::cout << std::endl;
}

template <class T>
void Print(const Array2D<T> &m)
{
    for (unsigned int i = 0; i < m.rows(); ++i)
    {
        for (unsigned int j = 0; j < m.columns(); ++j)
        {
            std::cout << m[i][j] << " ";
        }
        std::cout << "\n";
    }
}

int main()
{
    Array1D<float> a(10);
    a.clear();
    a[0] = 1.0;
    a[1] = 5.0;
    a[9] = 7.0;
    Print(a);
    Array1D<float> b(10);
    b = a;
    Print(b);
    Array1D<float> c(10);
    c = a;
    Print(c);
    c[4] = 9.0;
    printf("%s\n", b == c ? "=" : "#");    

    Array2D<float> a2(10,10);
    a2.clear();
    a2[0][0] = 1.0;
    a2[1][2] = 5.0;
    a2[9][8] = 7.0;
    Print(a2);
    Array2D<float> b2(a2);
    Print(b2);
    Array2D<float> c2(10,10);
    c2 = a2;
    c2[1][4] = 9.0;
    Print(c2);
    printf("%s\n", a == c ? "=" : "#");  
    getchar();
    
    return 0;
}

